﻿using JX.Core;
using JX.Core.Entity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace JX.Application
{
	/// <summary>
	/// 应用层服务实现类(基于Dapper)
	/// </summary>
	/// <typeparam name="T"></typeparam>
	public abstract class ServiceAppDapper<T> : IServiceAppDapper<T> where T : class, new()
	{
		#region 仓储接口
		private readonly IRepositoryDapper<T> _repository;
		/// <summary>
		/// 构造器注入
		/// </summary>
		/// <param name="repository"></param>
		public ServiceAppDapper(IRepositoryDapper<T> repository)
		{
			_repository = repository;
		}
		#endregion

		#region 得到第一行第一列的值
		/// <summary>
		/// 直接获取特定一个或者多个字段的值,多个字段需要声明Model。
		/// 例：var s = testDal.GetScalar《string》(m=>m.Name,m=>m.Code==1,m => m.OrderBy(item => item.ID).ThenBy(item => item.Name));
		/// var s = testDal.GetScalar《StoreM》(m=>new StoreM { Name1= m.Name, Code=m.Code },m=>m.Code==2,m => m.OrderBy(item => item.ID).ThenBy(item => item.Name));
		/// var s = testDal.GetScalar《dynamic》(m=>new { m.Name,m.Code },m=>m.Code==3,m => m.OrderBy(item => item.ID).ThenBy(item => item.Name));
		/// </summary>
		/// <typeparam name="TResult">数据结果</typeparam>
		/// <param name="scalar">要返回的结果，Lamda表达式（p=>p.Id）</param>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual TResult GetScalar<TResult>(Expression<Func<T, TResult>> scalar,
			Expression<Func<T, bool>> predicate = null,
			Expression<Func<IQueryable<T>, IOrderedQueryable<T>>> orderby = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetScalar<TResult>(scalar, predicate, orderby, writeAndRead);
		}
		/// <summary>
		/// 直接获取特定一个或者多个字段的值,多个字段需要声明Model。
		/// 例：var s = testDal.GetScalar《string》(m=>m.Name,m=>m.Code==1,m => m.OrderBy(item => item.ID).ThenBy(item => item.Name));
		/// var s = testDal.GetScalar《StoreM》(m=>new StoreM { Name1= m.Name, Code=m.Code },m=>m.Code==2,m => m.OrderBy(item => item.ID).ThenBy(item => item.Name));
		/// var s = testDal.GetScalar《dynamic》(m=>new { m.Name,m.Code },m=>m.Code==3,m => m.OrderBy(item => item.ID).ThenBy(item => item.Name));
		/// </summary>
		/// <typeparam name="TResult">数据结果</typeparam>
		/// <param name="scalar">要返回的结果，Lamda表达式（p=>p.Id）</param>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<TResult> GetScalarAsync<TResult>(Expression<Func<T, TResult>> scalar,
			Expression<Func<T, bool>> predicate = null,
			Expression<Func<IQueryable<T>, IOrderedQueryable<T>>> orderby = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetScalarAsync<TResult>(scalar, predicate, orderby, writeAndRead);
		}
		/// <summary>
		/// 得到第一行第一列的值
		/// </summary>
		/// <typeparam name="TResult">数据结果</typeparam>
		/// <param name="statistic">要返回的字段（如：count(*) 或者 UserName）</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual TResult GetScalar<TResult>(string statistic, string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetScalar<TResult>(statistic, strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 得到第一行第一列的值（异步方式）
		/// </summary>
		/// <typeparam name="TResult">数据结果</typeparam>
		/// <param name="statistic">要返回的字段（如：count(*) 或者 UserName）</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<TResult> GetScalarAsync<TResult>(string statistic, string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetScalarAsync<TResult>(statistic, strWhere, param, writeAndRead);
		}
		#endregion

		#region 得到所有行数
		/// <summary>
		/// 得到所有行数
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual int GetCount(Expression<Func<T, bool>> predicate, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetCount(predicate, writeAndRead);
		}
		/// <summary>
		/// 得到所有行数
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<int> GetCountAsync(Expression<Func<T, bool>> predicate, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetCountAsync(predicate, writeAndRead);
		}
		/// <summary>
		/// 得到所有行数
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual int GetCount(string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetCount(strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 得到所有行数（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<int> GetCountAsync(string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetCountAsync(strWhere, param, writeAndRead);
		}
		#endregion

		#region 得到最大ID、最新ID
		/// <summary>
		/// 得到数据表中第一个主键的最大数值
		/// </summary>
		/// <returns></returns>
		public virtual int GetMaxID()
		{
			return _repository.GetMaxID();
		}
		/// <summary>
		/// 得到数据表中第一个主键的最大数值（异步方式）
		/// </summary>
		/// <returns></returns>
		public virtual async Task<int> GetMaxIDAsync()
		{
			return await _repository.GetMaxIDAsync();
		}

		/// <summary>
		/// 得到数据表中第一个主键的最大数值加1
		/// </summary>
		/// <returns></returns>
		public virtual int GetNewID()
		{
			return GetMaxID() + 1;
		}
		/// <summary>
		/// 得到数据表中第一个主键的最大数值加1（异步方式）
		/// </summary>
		/// <returns></returns>
		public virtual async Task<int> GetNewIDAsync()
		{
			return await GetMaxIDAsync() + 1;
		}
		#endregion

		#region 验证是否存在
		/// <summary>
		/// 验证当前条件是否存在相同项
		/// </summary>
		/// <param name="predicate"></param>
		/// <returns></returns>
		public virtual bool IsExist(Expression<Func<T, bool>> predicate)
		{
			return _repository.IsExist(predicate);
		}
		/// <summary>
		/// 验证当前条件是否存在相同项（异步方式）
		/// </summary>
		/// <param name="predicate"></param>
		/// <returns></returns>
		public virtual async Task<bool> IsExistAsync(Expression<Func<T, bool>> predicate)
		{
			return await _repository.IsExistAsync(predicate);
		}
		/// <summary>
		/// 检查数据是否存在
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <returns></returns>
		public virtual bool IsExist(string strWhere = "", object param = null)
		{
			return _repository.IsExist(strWhere, param);
		}
		/// <summary>
		/// 检查数据是否存在（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <returns></returns>
		public virtual async Task<bool> IsExistAsync(string strWhere = "", object param = null)
		{
			return await _repository.IsExistAsync(strWhere, param);
		}
		#endregion

		#region 添加
		/// <summary>
		/// 增加一条记录
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual bool Add(T entity)
		{
			return _repository.Add(entity);
		}
		/// <summary>
		/// 增加一条记录（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual async Task<bool> AddAsync(T entity)
		{
			return await _repository.AddAsync(entity);
		}

		/// <summary>
		/// 增加多条记录，同一模型
		/// </summary>
		/// <param name="entityList">实体模型集合</param>
		/// <returns></returns>
		public virtual bool AddList(IList<T> entityList)
		{
			return _repository.AddList(entityList);
		}
		/// <summary>
		/// 增加多条记录，同一模型（异步方式）
		/// </summary>
		/// <param name="entityList">实体模型集合</param>
		/// <returns></returns>
		public virtual async Task<bool> AddListAsync(IList<T> entityList)
		{
			return await _repository.AddListAsync(entityList);
		}

		/// <summary>
		/// 增加一条记录，返回新的ID号。需要有一个单一主键，并且开启有标识符属性
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual int Insert(T entity)
		{
			return _repository.Insert(entity);
		}
		/// <summary>
		/// 增加一条记录，返回新的ID号。需要有一个单一主键，并且开启有标识符属性（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual async Task<int> InsertAsync(T entity)
		{
			return await _repository.InsertAsync(entity);
		}

		/// <summary>
		/// 增加或更新一条记录
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <param name="IsSave">是否增加</param>
		/// <returns></returns>
		public virtual bool AddOrUpdate(T entity, bool IsSave)
		{
			return IsSave ? Add(entity) : Update(entity);
		}
		/// <summary>
		/// 增加或更新一条记录（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <param name="IsSave">是否增加</param>
		/// <returns></returns>
		public virtual async Task<bool> AddOrUpdateAsync(T entity, bool IsSave)
		{
			return IsSave ? await AddAsync(entity) : await UpdateAsync(entity);
		}
		#endregion

		#region 删除
		/// <summary>
		/// 通过Lamda表达式，删除一条或多条记录
		/// </summary>
		/// <param name="predicate">Lamda表达式（p=>p.Id==Id）</param>
		/// <returns></returns>
		public virtual bool Delete(Expression<Func<T, bool>> predicate)
		{
			return _repository.Delete(predicate);
		}
		/// <summary>
		/// 通过Lamda表达式，删除一条或多条记录（异步方式）
		/// </summary>
		/// <param name="predicate">Lamda表达式（p=>p.Id==Id）</param>
		/// <returns></returns>
		public virtual async Task<bool> DeleteAsync(Expression<Func<T, bool>> predicate)
		{
			return await _repository.DeleteAsync(predicate);
		}
		/// <summary>
		/// 删除一条或多条记录
		/// </summary>
		/// <param name="strWhere">参数化删除条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <returns></returns>
		public virtual bool Delete(string strWhere = "", object param = null)
		{
			return _repository.Delete(strWhere, param);
		}
		/// <summary>
		/// 删除一条或多条记录（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化删除条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <returns></returns>
		public virtual async Task<bool> DeleteAsync(string strWhere = "", object param = null)
		{
			return await _repository.DeleteAsync(strWhere, param);
		}
		#endregion

		#region 修改
		/// <summary>
		/// 更新一条记录
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual bool Update(T entity)
		{
			return _repository.Update(entity);
		}
		/// <summary>
		/// 更新一条记录（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual async Task<bool> UpdateAsync(T entity)
		{
			return await _repository.UpdateAsync(entity);
		}
		/// <summary>
		/// 修改一条或多条记录
		/// </summary>
		/// <param name="strColumns">参数化要修改的列（如：ID = @ID,Name = @Name）</param>
		/// <param name="strWhere">参数化修改条件(例如: and ID = @ID)</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <returns></returns>
		public virtual bool Update(string strColumns, string strWhere = "", object param = null)
		{
			return _repository.Update(strColumns, strWhere, param);
		}
		/// <summary>
		/// 修改一条或多条记录（异步方式）
		/// </summary>
		/// <param name="strColumns">参数化要修改的列（如：ID = @ID,Name = @Name）</param>
		/// <param name="strWhere">参数化修改条件(例如: and ID = @ID)</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <returns></returns>
		public virtual async Task<bool> UpdateAsync(string strColumns, string strWhere = "", object param = null)
		{
			return await _repository.UpdateAsync(strColumns, strWhere, param);
		}
		/// <summary>
		/// 批量更新
		/// </summary>
		/// <param name="entityList"></param>
		/// <returns></returns>
		public virtual bool UpdateList(IList<T> entityList)
		{
			return _repository.UpdateList(entityList);
		}
		/// <summary>
		/// 批量更新
		/// </summary>
		/// <param name="entityList"></param>
		/// <returns></returns>
		public virtual async Task<bool> UpdateListAsync(IList<T> entityList)
		{
			return await _repository.UpdateListAsync(entityList);
		}
		#endregion

		#region 得到实体
		/// <summary>
		/// 通过Lamda表达式获取实体
		/// </summary>
		/// <param name="predicate">Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual T Get(Expression<Func<T, bool>> predicate, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.Get(predicate, writeAndRead);
		}
		/// <summary>
		/// 通过Lamda表达式获取实体（异步方式）
		/// </summary>
		/// <param name="predicate">Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<T> GetAsync(Expression<Func<T, bool>> predicate, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetAsync(predicate, writeAndRead);
		}
		/// <summary>
		/// 获取实体
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual T Get(string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.Get(strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 获取实体（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<T> GetAsync(string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetAsync(strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 获取实体
		/// </summary>
		/// <param name="strJoin">联合查询语句(例：inner join tablename t on t.id=t1.id)</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual T Get(string strJoin, string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.Get(strJoin, strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 获取实体（异步方式）
		/// </summary>
		/// <param name="strJoin">联合查询语句(例：inner join tablename t on t.id=t1.id)</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<T> GetAsync(string strJoin, string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetAsync(strJoin, strWhere, param, writeAndRead);
		}
		#endregion

		#region 得到实体列表
		/// <summary>
		/// 得到实体列表
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetList(Expression<Func<T, bool>> predicate,
			Expression<Func<IQueryable<T>, IOrderedQueryable<T>>> orderby = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetList(predicate, orderby, writeAndRead);
		}
		/// <summary>
		/// 得到实体列表
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<IEnumerable<T>> GetListAsync(Expression<Func<T, bool>> predicate,
			Expression<Func<IQueryable<T>, IOrderedQueryable<T>>> orderby = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetListAsync(predicate, orderby, writeAndRead);
		}
		/// <summary>
		/// 得到实体列表
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetList(string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetList(strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 得到实体列表（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<IEnumerable<T>> GetListAsync(string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetListAsync(strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 得到实体列表
		/// </summary>
		/// <param name="strJoin">联合查询语句(例：inner join tablename t on t.id=t1.id)</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetList(string strJoin, string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetList(strJoin, strWhere, param, writeAndRead);
		}
		/// <summary>
		/// 得到实体列表（异步方式）
		/// </summary>
		/// <param name="strJoin">联合查询语句(例：inner join tablename t on t.id=t1.id)</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<IEnumerable<T>> GetListAsync(string strJoin, string strWhere = "", object param = null, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetListAsync(strJoin, strWhere, param, writeAndRead);
		}
		#endregion

		#region 得到数据列表
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="selector">返回结果（必须是模型中存在的字段）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<TResult> GetAllData<TResult>(Expression<Func<T, bool>> predicate,
			Expression<Func<IQueryable<T>, IOrderedQueryable<T>>> orderby = null,
			Expression<Func<T, TResult>> selector = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetAllData<TResult>(predicate, orderby, selector, writeAndRead);
		}
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="selector">返回结果（必须是模型中存在的字段）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<IEnumerable<TResult>> GetAllDataAsync<TResult>(Expression<Func<T, bool>> predicate,
			Expression<Func<IQueryable<T>, IOrderedQueryable<T>>> orderby = null,
			Expression<Func<T, TResult>> selector = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetAllDataAsync<TResult>(predicate, orderby, selector, writeAndRead);
		}
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="selector">返回结果（必须是模型中存在的字段）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<TResult> GetAllData<TEntity, TResult>(Expression<Func<TEntity, bool>> predicate,
			Expression<Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>>> orderby = null,
			Expression<Func<TEntity, TResult>> selector = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
			where TEntity : class
		{
			return _repository.GetAllData(predicate, orderby, selector, writeAndRead);
		}
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <param name="predicate">查询条件，Lamda表达式（p=>p.Id==Id）</param>
		/// <param name="orderby">排序字段，Lamda表达式（p.OrderByDescending(item=>item.Timestamp).ThenBy(item=>item.Title)）</param>
		/// <param name="selector">返回结果（必须是模型中存在的字段）</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<IEnumerable<TResult>> GetAllDataAsync<TEntity, TResult>(Expression<Func<TEntity, bool>> predicate,
			Expression<Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>>> orderby = null,
			Expression<Func<TEntity, TResult>> selector = null,
			WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
			where TEntity : class
		{
			return await _repository.GetAllDataAsync(predicate, orderby, selector, writeAndRead);
		}
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <typeparam name="TResult"></typeparam>
		/// <param name="tableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="strExtended">返回的指定列(例如: extended = id + name 或 distinct name)</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<TResult> GetAllData<TResult>(string tableName, string strWhere = "", object param = null, string strExtended = "*", WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetAllData<TResult>(tableName, strWhere, param, strExtended, writeAndRead);
		}
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <typeparam name="TResult"></typeparam>
		/// <param name="tableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="strExtended">返回的指定列(例如: extended = id + name 或 distinct name)</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual async Task<IEnumerable<TResult>> GetAllDataAsync<TResult>(string tableName, string strWhere = "", object param = null, string strExtended = "*", WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetAllDataAsync<TResult>(tableName, strWhere, param, strExtended, writeAndRead);
		}
		#endregion

		#region 分页
		/// <summary>
		/// 通过存储过程“Common_GetList”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetListPaged(int startRowIndexId, int maxNumberRows, string Filter, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return GetListPaged(startRowIndexId, maxNumberRows, "", "", Filter, "", "", out Total, writeAndRead);
		}
		/// <summary>
		/// 通过存储过程“Common_GetList”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetListPaged(int startRowIndexId, int maxNumberRows, string StrColumn, string TableName, string Filter, string SortColumn, string Sorts, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListPaged(startRowIndexId, maxNumberRows, StrColumn, TableName, Filter, SortColumn, Sorts, out Total, writeAndRead);
		}
		/// <summary>
		/// 通过存储过程“Common_GetList”，得到分页后的数据
		/// </summary>
		/// <typeparam name="TResult">实体类</typeparam>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<TResult> GetListPaged<TResult>(int startRowIndexId, int maxNumberRows, string StrColumn, string TableName, string Filter, string SortColumn, string Sorts, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListPaged<TResult>(startRowIndexId, maxNumberRows, StrColumn, TableName, Filter, SortColumn, Sorts, out Total, writeAndRead);
		}

		/// <summary>
		/// 通过存储过程“Common_GetListBySortColumn”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumnDbType">排序字段的数据类型(如：int)</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetListPagedBySortColumn(int startRowIndexId, int maxNumberRows, string Filter, string SortColumnDbType, string SortColumn, string Sorts, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return GetListPagedBySortColumn(startRowIndexId, maxNumberRows, "", "", "", Filter, SortColumnDbType, SortColumn, Sorts, out Total, writeAndRead);
		}
		/// <summary>
		/// 通过存储过程“Common_GetListBySortColumn”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="PrimaryColumn">主键字段名</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumnDbType">排序字段的数据类型(默认：int)</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetListPagedBySortColumn(int startRowIndexId, int maxNumberRows, string PrimaryColumn, string StrColumn, string TableName, string Filter, string SortColumnDbType, string SortColumn, string Sorts, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListPagedBySortColumn(startRowIndexId, maxNumberRows, PrimaryColumn, StrColumn, TableName, Filter, SortColumnDbType, SortColumn, Sorts, out Total, writeAndRead);
		}
		/// <summary>
		/// 通过存储过程“Common_GetListBySortColumn”，得到分页后的数据
		/// </summary>
		/// <typeparam name="TResult">实体类</typeparam>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="PrimaryColumn">主键字段名</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumnDbType">排序字段的数据类型(如：int)</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<TResult> GetListPagedBySortColumn<TResult>(int startRowIndexId, int maxNumberRows, string PrimaryColumn, string StrColumn, string TableName, string Filter, string SortColumnDbType, string SortColumn, string Sorts, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListPagedBySortColumn<TResult>(startRowIndexId, maxNumberRows, PrimaryColumn, StrColumn, TableName, Filter, SortColumnDbType, SortColumn, Sorts, out Total, writeAndRead);
		}

		/// <summary>
		/// 通过存储过程“Statistics_GetListByPage”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="ID">用于分页的、不重复的字段</param>
		/// <param name="Group">分组语句（例：group by name,sex）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetListPagedByStat(int startRowIndexId, int maxNumberRows, string Filter, string ID, string Group, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return GetListPagedByStat(startRowIndexId, maxNumberRows, "", "", Filter, "", "", ID, Group, out Total, writeAndRead);
		}
		/// <summary>
		/// 通过存储过程“Statistics_GetListByPage”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="ID">用于分页的、不重复的字段</param>
		/// <param name="Group">分组语句（例：group by name,sex）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<T> GetListPagedByStat(int startRowIndexId, int maxNumberRows, string StrColumn, string TableName, string Filter, string SortColumn, string Sorts, string ID, string Group, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListPagedByStat(startRowIndexId, maxNumberRows, StrColumn, TableName, Filter, SortColumn, Sorts, ID, Group, out Total, writeAndRead);
		}
		/// <summary>
		/// 通过存储过程“Statistics_GetListByPage”，得到分页后的数据
		/// </summary>
		/// <typeparam name="TResult">实体类</typeparam>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="ID">用于分页的、不重复的字段</param>
		/// <param name="Group">分组语句（例：group by name,sex）</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public virtual IEnumerable<TResult> GetListPagedByStat<TResult>(int startRowIndexId, int maxNumberRows, string StrColumn, string TableName, string Filter, string SortColumn, string Sorts, string ID, string Group, out int Total, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListPagedByStat<TResult>(startRowIndexId, maxNumberRows, StrColumn, TableName, Filter, SortColumn, Sorts, ID, Group, out Total, writeAndRead);
		}
		#endregion

		#region 执行SQL，检验是否存在数据
		/// <summary>
		/// 执行SQL，检验是否存在数据
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="strWhere"></param>
		/// <param name="param"></param>
		/// <param name="commandType"></param>
		/// <returns></returns>
		public bool IsExistBySql(string tableName, string strWhere, object param = null, CommandType commandType = CommandType.Text)
		{
			return _repository.IsExistBySql(tableName, strWhere, param, commandType);
		}
		/// <summary>
		/// 执行SQL，检验是否存在数据
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="strWhere"></param>
		/// <param name="param"></param>
		/// <param name="commandType"></param>
		/// <returns></returns>
		public async Task<bool> IsExistBySqlAsync(string tableName, string strWhere, object param = null, CommandType commandType = CommandType.Text)
		{
			return await _repository.IsExistBySqlAsync(tableName, strWhere, param, commandType);
		}
		#endregion

		#region 运行SQL语句,返回受影响的行数
		/// <summary>
		/// 执行SQL语句并返回受影响的行数
		/// </summary>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType">是存储过程还是SQL语句</param>
		/// <returns></returns>
		public int ExeSQL(string sql, object param = null, CommandType commandType = CommandType.Text)
		{
			return _repository.ExeSQL(sql, param, commandType);
		}
		/// <summary>
		/// 执行SQL语句并返回受影响的行数（异步）
		/// </summary>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType">是存储过程还是SQL语句</param>
		/// <returns></returns>
		public async Task<int> ExeSQLAsync(string sql, object param = null, CommandType commandType = CommandType.Text)
		{
			return await _repository.ExeSQLAsync(sql, param, commandType);
		}
		#endregion

		#region 执行SQL，返回结果
		/// <summary>
		/// 执行SQL，返回结果。例：
		/// var s = testDal.GetBySQL《string》("select name from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《StoreM》("select * from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《dynamic》("select name,Code from tablename where Id=@Id",new { Id = id });
		/// </summary>
		/// <typeparam name="TResult"></typeparam>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public TResult GetBySQL<TResult>(string sql, object param = null, CommandType commandType = CommandType.Text, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetBySQL<TResult>(sql, param, commandType);
		}
		/// <summary>
		/// 执行SQL，返回结果。例：
		/// var s = testDal.GetBySQL《string》("select name from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《StoreM》("select * from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《dynamic》("select name,Code from tablename where Id=@Id",new { Id = id });
		/// </summary>
		/// <typeparam name="TResult"></typeparam>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public async Task<TResult> GetBySQLAsync<TResult>(string sql, object param = null, CommandType commandType = CommandType.Text, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetBySQLAsync<TResult>(sql, param, commandType);
		}
		#endregion

		#region 执行SQL，返回结果列表
		/// <summary>
		/// 执行SQL，返回结果。例：
		/// var s = testDal.GetBySQL《string》("select name from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《StoreM》("select * from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《dynamic》("select name,Code from tablename where Id=@Id",new { Id = id });
		/// </summary>
		/// <typeparam name="TResult"></typeparam>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public IEnumerable<TResult> GetListBySQL<TResult>(string sql, object param = null, CommandType commandType = CommandType.Text, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetListBySQL<TResult>(sql, param, commandType);
		}
		/// <summary>
		/// 执行SQL，返回结果。例：
		/// var s = testDal.GetBySQL《string》("select name from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《StoreM》("select * from tablename where Id=@Id",new { Id = id });
		/// var s = testDal.GetBySQL《dynamic》("select name,Code from tablename where Id=@Id",new { Id = id });
		/// </summary>
		/// <typeparam name="TResult"></typeparam>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public async Task<IEnumerable<TResult>> GetListBySQLAsync<TResult>(string sql, object param = null, CommandType commandType = CommandType.Text, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetListBySQLAsync<TResult>(sql, param, commandType);
		}
		#endregion

		#region 执行SQL，返回DataTable
		/// <summary>
		/// 执行SQL，返回DataTable
		/// </summary>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public DataTable GetDataTableBySql(string sql, object param = null, CommandType commandType = CommandType.Text, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return _repository.GetDataTableBySql(sql, param, commandType);
		}
		/// <summary>
		/// 执行SQL，返回DataTable
		/// </summary>
		/// <param name="sql">SQL语句，例：select id from Area where id in @ids</param>
		/// <param name="param">用于此查询的参数（例：new { Id = id }，如果是IN操作，传入：new { ids = new int[2] { 1, 2 } }）</param>
		/// <param name="commandType"></param>
		/// <param name="writeAndRead"></param>
		/// <returns></returns>
		public async Task<DataTable> GetDataTableBySqlAsync(string sql, object param = null, CommandType commandType = CommandType.Text, WriteAndReadEnum writeAndRead = WriteAndReadEnum.None)
		{
			return await _repository.GetDataTableBySqlAsync(sql, param, commandType);
		}
		#endregion
	}
}
